#ifndef PHYSICSBODY_H
#define PHYSICSBODY_H

#include <Eigen/Core>
#include <Eigen/Geometry>
#include "typedefs.h"
#include "vector3.h"
#include "quaternion.h"
#include "aabb.h"
#include <QColor>
#include "TriMesh.h"

class RigidBody
{
public:

    static int nbRigidBodies;

    int id;

    enum BodyType{BOX,SPHERE,MESH};

    BodyType type;

    void * physicsBody;

    Math::Vector3 position;
    Math::Quaternion orientation;
    Math::Vector3 initPosition;
    Math::Quaternion initOrientation;
    QColor color;
    bool isStatic;

    //For box
    Math::Vector3 size;
    //For sphere
    Math::Real radius;
    //For mesh
    QString mesh_filename;
    TriMesh *mesh;

    Math::AABB aabb;

    RigidBody(BodyType type,void *physicsBody) : type(type) ,physicsBody(physicsBody) {
        id = nbRigidBodies++;

        position.setValue(0);
        orientation.setIdentity();
        initPosition = position;
        initOrientation = orientation;

        isStatic = false;
    }

//    virtual ~RigidBody(){
//        //physicsBody = NULL;
//    }

};

#endif // PHYSICSBODY_H
